package com.hp.consumer.controller;

import com.hp.common.api.UserService;
import com.hp.common.common.Result;
import com.hp.common.entity.UpdateUserParam;
import com.hp.common.entity.User;
import org.apache.dubbo.config.annotation.DubboReference;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @author dongxing
 **/
@RestController
@RequestMapping("/user")
public class UserController {

    @DubboReference
    private UserService userService;


    @GetMapping("/echo/{id}")
    public User show(@PathVariable String id) {
        return this.userService.findUserByName(id);
    }

    @GetMapping("/echo/valid")
    public Result<UpdateUserParam> valid() {
        return this.userService.updateUser(UpdateUserParam.builder().build());
    }

}
